home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / music / 7 / pascal / tsize.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1985-11-19  |  3.5 KB  |  117 lines

  1. PROGRAM name ;
  2.  
  3.   CONST
  4.     {$I gemconst.pas}
  5.  
  6.   TYPE
  7.     {$I gemtype.pas}
  8.  
  9.   VAR
  10.     height : integer ;
  11.     s : Str255 ;
  12.  
  13.   {$I gemsubs.pas}
  14.  
  15.   { Text_Height - Set the height in pixels of text, when it is drawn using the
  16.       Draw_String library call. }
  17.  
  18.   PROCEDURE Text_Height( height : integer ) ;
  19.  
  20.     TYPE
  21.       Ctrl_Parms      = ARRAY [ 0..11 ] OF integer ;
  22.       Int_In_Parms    = ARRAY [ 0..15 ] OF integer ;
  23.       Int_Out_Parms   = ARRAY [ 0..45 ] OF integer ;
  24.       Pts_In_Parms    = ARRAY [ 0..11 ] OF integer ;
  25.       Pts_Out_Parms   = ARRAY [ 0..11 ] OF integer ;
  26.  
  27.     VAR
  28.       control : Ctrl_Parms ;
  29.       int_in  : Int_In_Parms ;
  30.       int_out : Int_Out_Parms ;
  31.       pts_in  : Pts_In_Parms ;
  32.       pts_out : Pts_Out_Parms ;
  33.  
  34.     PROCEDURE VDI_Call( cmd, sub_cmd : integer ; nints, npts : integer ;
  35.                 VAR ctrl : Ctrl_Parms ;
  36.                 VAR int_in : Int_In_Parms ; VAR int_out : Int_Out_Parms ;
  37.                 VAR pts_in : Pts_In_Parms ; VAR pts_out : Pts_Out_Parms ;
  38.                 translate : boolean ) ;
  39.       EXTERNAL ;
  40.  
  41.     BEGIN
  42.       pts_in[0] := 0 ;
  43.       pts_in[1] := height ;
  44.       VDI_Call(12, 0, 0, 2, control, int_in, int_out, pts_in, pts_out, false);
  45.     END ;
  46.  
  47.   { Get_Height - Get the height in pixels of text, when it is drawn using the
  48.       Draw_String library call. }
  49.  
  50.   FUNCTION Get_Height : integer ;
  51.  
  52.     TYPE
  53.       Ctrl_Parms      = ARRAY [ 0..11 ] OF integer ;
  54.       Int_In_Parms    = ARRAY [ 0..15 ] OF integer ;
  55.       Int_Out_Parms   = ARRAY [ 0..45 ] OF integer ;
  56.       Pts_In_Parms    = ARRAY [ 0..11 ] OF integer ;
  57.       Pts_Out_Parms   = ARRAY [ 0..11 ] OF integer ;
  58.  
  59.     VAR
  60.       control : Ctrl_Parms ;
  61.       int_in  : Int_In_Parms ;
  62.       int_out : Int_Out_Parms ;
  63.       pts_in  : Pts_In_Parms ;
  64.       pts_out : Pts_Out_Parms ;
  65.  
  66.     PROCEDURE VDI_Call( cmd, sub_cmd : integer ; nints, npts : integer ;
  67.                 VAR ctrl : Ctrl_Parms ;
  68.                 VAR int_in : Int_In_Parms ; VAR int_out : Int_Out_Parms ;
  69.                 VAR pts_in : Pts_In_Parms ; VAR pts_out : Pts_Out_Parms ;
  70.                 translate : boolean ) ;
  71.       EXTERNAL ;
  72.  
  73.     BEGIN
  74.       VDI_Call(131, 0, 0, 0, control, int_in, int_out, pts_in, pts_out, false);
  75.       Get_Height := pts_out[9] ;
  76.     END ;
  77.  
  78.  
  79.  
  80.   PROCEDURE wait_button ;
  81.  
  82.     VAR
  83.       msg : Message_Buffer ;
  84.       junk : integer ;
  85.  
  86.     BEGIN
  87.       junk := Get_Event( E_Button, 1, 1, 1, 0,
  88.                         false, 0, 0, 0, 0, false, 0, 0, 0, 0,
  89.                         msg, junk, junk, junk, junk, junk, junk ) ;
  90.       junk := Get_Event( E_Button, 1, 0, 1, 0,
  91.                         false, 0, 0, 0, 0, false, 0, 0, 0, 0,
  92.                         msg, junk, junk, junk, junk, junk, junk ) ;
  93.     END ;
  94.  
  95.   BEGIN
  96.     IF Init_Gem >= 0 THEN
  97.       BEGIN
  98.         s := 'nn mm This is a test-- xyzlq' ;
  99.         s[4] := chr( Get_Height DIV 10 + ord( '0' ) ) ;
  100.         s[5] := chr( Get_Height MOD 10 + ord( '0' ) ) ;
  101.         Draw_String( 20, 190, s ) ;
  102.         wait_button ;
  103.         FOR height := 2 TO 99 DO
  104.           BEGIN
  105.             Text_Height( height ) ;
  106.             s[1] := chr( height DIV 10 + ord( '0' ) ) ;
  107.             s[2] := chr( height MOD 10 + ord( '0' ) ) ;
  108.             s[4] := chr( Get_Height DIV 10 + ord( '0' ) ) ;
  109.             s[5] := chr( Get_Height MOD 10 + ord( '0' ) ) ;
  110.             Draw_String( 20, 190, s ) ;
  111.             wait_button ;
  112.           END ;
  113.         Exit_Gem ;
  114.       END ;
  115.   END.
  116.  
  117. NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN